package com.adee.kaoshi;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test004 {
    public static void main(String[] args) {
        String patternStr = "[\\w\\.]*";  // \w匹配单词，即字母、数字、下划线组成的字符串。中括号表示将其中的正则内容看成一个整体
        Pattern pattern = Pattern.compile(patternStr);

        String addr1 = "www.huawei.com";
        Matcher matcher1 = pattern.matcher(addr1);
        System.out.println(matcher1.matches());

        String addr2 = "w3.huawei.com";
        Matcher matcher2 = pattern.matcher(addr2);
        System.out.println(matcher2.matches());
    }
}
